<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button class="b1" data-num="100">输出100</button>
    <button class="b2" data-num="200">输出200</button>
    <script>
      const b1 = document.querySelector(".b1");

      b1.addEventListener("click", function (event) {
        console.log(event.target.dataset.num);
      });
    </script>
  </body>
</html>
